export let initState = {
    list:[],
    goodsNav:["热门商品","全部商品","折扣专区","上心推荐"],
    n:0
}

export const reducer = (state,action) => {
    switch(action.type){
        case "changeList":
            
            return {
                ...state,
                list:action.arr
            }
        case "changeN":
            return {
                ...state,
                n:action.n
            }
        
        default:
            return state
    }
}

export let actions = {
    changeList:(arr)=>{
        
        return {type:"changeList",arr}
    },
    changeN:(n)=>({type:"changeN",n})
}

export let getList = state => state.list
export let getgoodsNav = state => state.goodsNav
export let getN = state => state.n
export let getShow=state=>state.list.length>0?state.list[state.n].content:[]

